<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Bayesian Network: bayesian/cpt.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Bayesian Network
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_4922399365a46b010edf8e4eee2a5dfb.html">bayesian</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">cpt.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="cpt_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef BAYESIAN_NETWORKS_CPT_HPP</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define BAYESIAN_NETWORKS_CPT_HPP</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;unordered_map&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="matrix_8hpp.html">bayesian/matrix.hpp</a>&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="component_8hpp.html">bayesian/network/component.hpp</a>&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacebn.html">bn</a> {</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html">   33</a></span>&#160;<span class="keyword">class </span><a class="code" href="classbn_1_1cpt.html">cpt</a> {</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="keyword">using</span> rv_ptr = component::random_variable_ptr;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <span class="keyword">using</span> <a class="code" href="classbn_1_1matrix.html">matrix_type</a> = <a class="code" href="classbn_1_1matrix.html">matrix&lt;std::vector&lt;double&gt;</a>&gt;;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keyword">using</span> condition_type = std::unordered_map&lt;rv_ptr, std::size_t&gt;;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a58fdfe1f84fad252a8ab6f1a859bf243">   45</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="classbn_1_1cpt.html#a58fdfe1f84fad252a8ab6f1a859bf243">cpt</a>(rv_ptr <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>)</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        : rv_(<a class="code" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>)</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    {</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        create_matrix({});</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    }</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a88f060dddaf78715a39846c4083f1edf">   58</a></span>&#160;    <a class="code" href="classbn_1_1cpt.html#a88f060dddaf78715a39846c4083f1edf">cpt</a>(rv_ptr <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>, std::vector&lt;rv_ptr&gt; <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>)</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        : rv_(<a class="code" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>), parents_(<a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>)</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    {</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        create_matrix(<a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>);</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    }</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a6543249e9a1fe5ce044996b9e7f73ece">   65</a></span>&#160;    <a class="code" href="classbn_1_1cpt.html#a6543249e9a1fe5ce044996b9e7f73ece">cpt</a>(<a class="code" href="classbn_1_1cpt.html">cpt</a> <span class="keyword">const</span>&amp; other)</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        : rv_(other.rv_), parents_(other.parents_), matrix_(new <a class="code" href="classbn_1_1matrix.html">matrix_type</a>(*other.matrix_))</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    {</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    }</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#afbccb3e93eb13b24099fcdd4a4af32f2">   71</a></span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classbn_1_1cpt.html#afbccb3e93eb13b24099fcdd4a4af32f2">~cpt</a>()</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    {</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;        <span class="keyword">delete</span> matrix_;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    }</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#ae5fe3c2f5f6398ba02d543dd946ba9e3">   77</a></span>&#160;    <a class="code" href="classbn_1_1cpt.html">cpt</a>&amp; <a class="code" href="classbn_1_1cpt.html#ae5fe3c2f5f6398ba02d543dd946ba9e3">operator=</a>(<a class="code" href="classbn_1_1cpt.html">cpt</a> <span class="keyword">const</span>&amp; other)</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    {</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        *<span class="keyword">this</span> = <a class="code" href="classbn_1_1cpt.html">cpt</a>{other};</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    }</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#ae8651cbb4c5e6ffd12e2c6817f200450">   86</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classbn_1_1cpt.html#ae8651cbb4c5e6ffd12e2c6817f200450">reset</a>(std::vector&lt;rv_ptr&gt; <a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>)</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    {</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        create_matrix(<a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>);</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        std::swap(this-&gt;parents_, parents_);</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    }</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#ab561a7d4b7aee7b6b674695bf5212780">   97</a></span>&#160;    matrix_type::element_type&amp; <a class="code" href="classbn_1_1cpt.html#ab561a7d4b7aee7b6b674695bf5212780">at</a>(condition_type <span class="keyword">const</span>&amp; condition)</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    {</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        <span class="keywordflow">return</span> matrix_-&gt;<a class="code" href="classbn_1_1matrix.html#a142ce97a5068a2c0b1677adf45f5b041">at</a>(<a class="code" href="classbn_1_1cpt.html#a9340fe9dcd844e997d3779aa21fbb6c9">condition_to_index</a>(condition));</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    }</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a30a4012c2deaa0d3ab795e564fd16d95">  107</a></span>&#160;    matrix_type::element_type <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#a30a4012c2deaa0d3ab795e564fd16d95">at</a>(condition_type <span class="keyword">const</span>&amp; condition)<span class="keyword"> const</span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        <span class="keywordflow">return</span> matrix_-&gt;<a class="code" href="classbn_1_1matrix.html#a142ce97a5068a2c0b1677adf45f5b041">at</a>(<a class="code" href="classbn_1_1cpt.html#a9340fe9dcd844e997d3779aa21fbb6c9">condition_to_index</a>(condition));</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    }</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a4e5ae968e96043ce5b37077ec071bcfe">  117</a></span>&#160;    matrix_type::element_type&amp; <a class="code" href="classbn_1_1cpt.html#a4e5ae968e96043ce5b37077ec071bcfe">operator[] </a>(condition_type <span class="keyword">const</span>&amp; condition)</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    {</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;        <span class="keywordflow">return</span> matrix_-&gt;operator[](<a class="code" href="classbn_1_1cpt.html#a9340fe9dcd844e997d3779aa21fbb6c9">condition_to_index</a>(condition));</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    }</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div><div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a90b08e643cbcd1c030e69771b30b308a">  127</a></span>&#160;    matrix_type::element_type <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#a4e5ae968e96043ce5b37077ec071bcfe">operator[] </a>(condition_type <span class="keyword">const</span>&amp; condition)<span class="keyword"> const</span></div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        <span class="keywordflow">return</span> matrix_-&gt;operator[](<a class="code" href="classbn_1_1cpt.html#a9340fe9dcd844e997d3779aa21fbb6c9">condition_to_index</a>(condition));</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    }</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;</div><div class="line"><a name="l00136"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">  136</a></span>&#160;    rv_ptr <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>() const noexcept</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    {</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        <span class="keywordflow">return</span> rv_;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    }</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    </div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">  145</a></span>&#160;    std::vector&lt;rv_ptr&gt; <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>() const noexcept</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    {</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        <span class="keywordflow">return</span> parents_;</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    }</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;</div><div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a1e5ffeaddbac53651afbbe782170de6d">  155</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1cpt.html#a1e5ffeaddbac53651afbbe782170de6d">is_valid</a>(condition_type <span class="keyword">const</span>&amp; condition) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    {</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> <span class="keyword">const</span>&amp; parent : <a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>())</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        {</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;            <span class="keyword">auto</span> <span class="keyword">const</span> it = condition.find(parent);</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;            <span class="keywordflow">if</span>(it == condition.end() || it-&gt;second &gt;= parent-&gt;max_value)</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        }</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    }</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div><div class="line"><a name="l00174"></a><span class="lineno"><a class="line" href="classbn_1_1cpt.html#a9340fe9dcd844e997d3779aa21fbb6c9">  174</a></span>&#160;    std::vector&lt;std::size_t&gt; <a class="code" href="classbn_1_1cpt.html#a9340fe9dcd844e997d3779aa21fbb6c9">condition_to_index</a>(condition_type <span class="keyword">const</span>&amp; condition)<span class="keyword"> const</span></div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;        <span class="keywordflow">if</span>(parents_.empty())</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;        {</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;            <span class="keywordflow">return</span> std::vector&lt;std::size_t&gt;{0};</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;        }</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;        <span class="keywordflow">else</span></div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;        {</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;            std::vector&lt;std::size_t&gt; index(parents_.size());</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;            <span class="keywordflow">for</span>(std::size_t i = 0; i &lt; parents_.size(); ++i)</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;            {</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;                index[i] = condition.at(parents_[i]); <span class="comment">// if condition does not have parents_[i] as key, the exception is thrown.</span></div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;                <span class="keywordflow">if</span>(index[i] &gt;= parents_[i]-&gt;max_value)</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;                    <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Condition is out of range&quot;</span>);</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;            }</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;            <span class="keywordflow">return</span> index;</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;        }</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    }</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    <span class="keywordtype">void</span> create_matrix(std::vector&lt;rv_ptr&gt; <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>)</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    {</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;        <span class="keywordflow">if</span>(rv_-&gt;max_value == 0)</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;            <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Target random variables cannot take any value.&quot;</span>);</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        <span class="keywordflow">if</span>(std::any_of(<a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>.cbegin(), <a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>.cend(), [](<span class="keyword">auto</span> <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>){ <span class="keywordflow">return</span> <a class="code" href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">rv</a>-&gt;max_value == 0; }))</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;            <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Parent random variables which cannot take any value exist.&quot;</span>);</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;        <span class="keywordflow">if</span>(<a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>.empty())</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;        {</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;            <span class="keyword">auto</span>* new_matrix = <span class="keyword">new</span> matrix_type(std::vector&lt;double&gt;{1}, std::vector&lt;double&gt;(rv_-&gt;max_value));</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;            std::swap(matrix_, new_matrix);</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;            <span class="keyword">delete</span> new_matrix;</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;        }</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;        <span class="keywordflow">else</span></div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;        {</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;            std::vector&lt;std::size_t&gt; size(<a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>.size());</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;            std::transform(</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;                <a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>.cbegin(), <a class="code" href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">parents</a>.cend(), size.begin(),</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;                [](rv_ptr <span class="keyword">const</span>&amp; parent){ <span class="keywordflow">return</span> parent-&gt;max_value; });</div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;</div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;            <span class="keyword">auto</span>* new_matrix = <span class="keyword">new</span> matrix_type(size, std::vector&lt;double&gt;(rv_-&gt;max_value));</div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;            std::swap(matrix_, new_matrix);</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;            <span class="keyword">delete</span> new_matrix;</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;        }</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;    }</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    rv_ptr <span class="keyword">const</span> rv_;</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    std::vector&lt;rv_ptr&gt; parents_;</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;    matrix_type* matrix_ = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;};</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;</div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;</div><div class="line"><a name="l00237"></a><span class="lineno"><a class="line" href="classbn_1_1cpt__manager.html">  237</a></span>&#160;<span class="keyword">class </span><a class="code" href="classbn_1_1cpt__manager.html">cpt_manager</a> {</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;    <span class="keyword">using</span> <a class="code" href="classbn_1_1cpt.html">cpt_type</a> = <a class="code" href="classbn_1_1cpt.html">cpt</a>;</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    <span class="keyword">using</span> node_type = component::node_ptr;</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    <a class="code" href="classbn_1_1cpt__manager.html#a14706adf5f0b9ec4f94628e4a8a1a43d">cpt_manager</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classbn_1_1cpt__manager.html#a65bf22a246a82147fdb83bba68c1e155">~cpt_manager</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;</div><div class="line"><a name="l00253"></a><span class="lineno"><a class="line" href="classbn_1_1cpt__manager.html#aac8b96ac9f6714005bc5fc790441e815">  253</a></span>&#160;    <a class="code" href="classbn_1_1cpt.html">cpt_type</a>&amp; <a class="code" href="classbn_1_1cpt__manager.html#aac8b96ac9f6714005bc5fc790441e815">enroll</a>(node_type <span class="keyword">const</span>&amp; node, <a class="code" href="classbn_1_1cpt.html">cpt_type</a> <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt.html">cpt</a>)</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    {</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classbn_1_1cpt__manager.html#aac8b96ac9f6714005bc5fc790441e815">enroll</a>(node, <a class="code" href="classbn_1_1cpt.html">cpt_type</a>(<a class="code" href="classbn_1_1cpt.html">cpt</a>));</div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;    }</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;</div><div class="line"><a name="l00264"></a><span class="lineno"><a class="line" href="classbn_1_1cpt__manager.html#a8b561a118dfde15785294db332eb1dcb">  264</a></span>&#160;    <a class="code" href="classbn_1_1cpt.html">cpt_type</a>&amp; <a class="code" href="classbn_1_1cpt__manager.html#a8b561a118dfde15785294db332eb1dcb">enroll</a>(node_type <span class="keyword">const</span>&amp; node, <a class="code" href="classbn_1_1cpt.html">cpt_type</a>&amp;&amp; <a class="code" href="classbn_1_1cpt.html">cpt</a>)</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    {</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;        <span class="keyword">auto</span> it = cpt_list_.find(node);</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;        <span class="keywordflow">if</span>(it != cpt_list_.end())</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;        {</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;            <span class="comment">// override</span></div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;            it-&gt;second = std::move(<a class="code" href="classbn_1_1cpt.html">cpt</a>);</div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;        }</div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;        <span class="keywordflow">else</span></div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;        {</div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;            <span class="comment">// add to list, and update iterator variable</span></div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;            it = cpt_list_.emplace(</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;                std::piecewise_construct,</div><div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;                std::forward_as_tuple(node),</div><div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;                std::forward_as_tuple(std::move(<a class="code" href="classbn_1_1cpt.html">cpt</a>))</div><div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;                ).first;</div><div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;        }</div><div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;</div><div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;        <span class="keywordflow">return</span> it-&gt;second;</div><div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;    }</div><div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;</div><div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;</div><div class="line"><a name="l00288"></a><span class="lineno"><a class="line" href="classbn_1_1cpt__manager.html#a40b8026c5e356912aa9b7f9ee219db66">  288</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classbn_1_1cpt__manager.html#a40b8026c5e356912aa9b7f9ee219db66">unenroll</a>(node_type <span class="keyword">const</span>&amp; node)</div><div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;    {</div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> it = cpt_list_.find(node);</div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        <span class="keywordflow">if</span>(it != cpt_list_.end())</div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;        {</div><div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;            cpt_list_.erase(it);</div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;        }</div><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;    }</div><div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;</div><div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;</div><div class="line"><a name="l00300"></a><span class="lineno"><a class="line" href="classbn_1_1cpt__manager.html#a07a7bded51671a92626b4737b8435de4">  300</a></span>&#160;    <a class="code" href="classbn_1_1cpt.html">cpt_type</a>&amp; <a class="code" href="classbn_1_1cpt__manager.html#a07a7bded51671a92626b4737b8435de4">operator[]</a>(node_type <span class="keyword">const</span>&amp; node)</div><div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;    {</div><div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;        <span class="keyword">auto</span> it = cpt_list_.find(node);</div><div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;        <span class="keywordflow">if</span>(it == cpt_list_.end())</div><div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;        {</div><div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;            <a class="code" href="classbn_1_1cpt.html">cpt_type</a> new_cpt(node-&gt;get());</div><div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;            it = cpt_list_.emplace(</div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;                std::piecewise_construct,</div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;                std::forward_as_tuple(node),</div><div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;                std::forward_as_tuple(new_cpt)</div><div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;                ).first;</div><div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;        }</div><div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;</div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;        <span class="keywordflow">return</span> it-&gt;second;</div><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;    }</div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;</div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;</div><div class="line"><a name="l00319"></a><span class="lineno"><a class="line" href="classbn_1_1cpt__manager.html#a14f03f543695c769641ba4d2ed46761e">  319</a></span>&#160;    <a class="code" href="classbn_1_1cpt.html">cpt_type</a>&amp; <a class="code" href="classbn_1_1cpt__manager.html#a14f03f543695c769641ba4d2ed46761e">at</a>(node_type <span class="keyword">const</span>&amp; node)</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;    {</div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;        <span class="keywordflow">return</span> cpt_list_.at(node);</div><div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    }</div><div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;</div><div class="line"><a name="l00327"></a><span class="lineno"><a class="line" href="classbn_1_1cpt__manager.html#af9f641392ccc1b1b0cc1361c270b9142">  327</a></span>&#160;    <a class="code" href="classbn_1_1cpt.html">cpt_type</a> <span class="keyword">const</span>&amp; <a class="code" href="classbn_1_1cpt__manager.html#af9f641392ccc1b1b0cc1361c270b9142">at</a>(node_type <span class="keyword">const</span>&amp; node)<span class="keyword"> const</span></div><div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;        <span class="keywordflow">return</span> cpt_list_.at(node);</div><div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;    }</div><div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;</div><div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    std::unordered_map&lt;node_type, cpt_type&gt; cpt_list_;</div><div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;};</div><div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;</div><div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;} <span class="comment">// namespace bn</span></div><div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;</div><div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;<span class="preprocessor">#endif // #ifndef BAYESIAN_NETWORKS_CPT_HPP</span></div><div class="ttc" id="classbn_1_1cpt__manager_html_aac8b96ac9f6714005bc5fc790441e815"><div class="ttname"><a href="classbn_1_1cpt__manager.html#aac8b96ac9f6714005bc5fc790441e815">bn::cpt_manager::enroll</a></div><div class="ttdeci">cpt_type &amp; enroll(node_type const &amp;node, cpt_type const &amp;cpt)</div><div class="ttdoc">Register CPT to this CPT manager. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:253</div></div>
<div class="ttc" id="classbn_1_1cpt_html_a9340fe9dcd844e997d3779aa21fbb6c9"><div class="ttname"><a href="classbn_1_1cpt.html#a9340fe9dcd844e997d3779aa21fbb6c9">bn::cpt::condition_to_index</a></div><div class="ttdeci">std::vector&lt; std::size_t &gt; condition_to_index(condition_type const &amp;condition) const</div><div class="ttdoc">Convert condition of conditional r.v. into access list of matrix. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:174</div></div>
<div class="ttc" id="namespacebn_html"><div class="ttname"><a href="namespacebn.html">bn</a></div><div class="ttdef"><b>Definition:</b> algorithm.hpp:16</div></div>
<div class="ttc" id="classbn_1_1matrix_html"><div class="ttname"><a href="classbn_1_1matrix.html">bn::matrix</a></div><div class="ttdoc">Provide a class representing dinamic N dimensions (N is equal to or greater than 1). </div><div class="ttdef"><b>Definition:</b> matrix.hpp:26</div></div>
<div class="ttc" id="classbn_1_1cpt_html_a6543249e9a1fe5ce044996b9e7f73ece"><div class="ttname"><a href="classbn_1_1cpt.html#a6543249e9a1fe5ce044996b9e7f73ece">bn::cpt::cpt</a></div><div class="ttdeci">cpt(cpt const &amp;other)</div><div class="ttdoc">(Copy ctor) </div><div class="ttdef"><b>Definition:</b> cpt.hpp:65</div></div>
<div class="ttc" id="matrix_8hpp_html"><div class="ttname"><a href="matrix_8hpp.html">matrix.hpp</a></div><div class="ttdoc">Provide a class representing matrix. </div></div>
<div class="ttc" id="classbn_1_1cpt__manager_html_a65bf22a246a82147fdb83bba68c1e155"><div class="ttname"><a href="classbn_1_1cpt__manager.html#a65bf22a246a82147fdb83bba68c1e155">bn::cpt_manager::~cpt_manager</a></div><div class="ttdeci">virtual ~cpt_manager()=default</div><div class="ttdoc">(Default dtor) </div></div>
<div class="ttc" id="classbn_1_1cpt_html_a88f060dddaf78715a39846c4083f1edf"><div class="ttname"><a href="classbn_1_1cpt.html#a88f060dddaf78715a39846c4083f1edf">bn::cpt::cpt</a></div><div class="ttdeci">cpt(rv_ptr const &amp;rv, std::vector&lt; rv_ptr &gt; const &amp;parents)</div><div class="ttdoc">(ctor) Initialize CPT by node and parent (conditional) node list </div><div class="ttdef"><b>Definition:</b> cpt.hpp:58</div></div>
<div class="ttc" id="classbn_1_1cpt_html_a30a4012c2deaa0d3ab795e564fd16d95"><div class="ttname"><a href="classbn_1_1cpt.html#a30a4012c2deaa0d3ab795e564fd16d95">bn::cpt::at</a></div><div class="ttdeci">matrix_type::element_type const  &amp; at(condition_type const &amp;condition) const</div><div class="ttdoc">Access to probability list by condition r.v. list (const version). </div><div class="ttdef"><b>Definition:</b> cpt.hpp:107</div></div>
<div class="ttc" id="classbn_1_1matrix_html_a142ce97a5068a2c0b1677adf45f5b041"><div class="ttname"><a href="classbn_1_1matrix.html#a142ce97a5068a2c0b1677adf45f5b041">bn::matrix::at</a></div><div class="ttdeci">Elem &amp; at(T const &amp;index)</div><div class="ttdoc">Access to element. </div><div class="ttdef"><b>Definition:</b> matrix.hpp:325</div></div>
<div class="ttc" id="classbn_1_1cpt_html_afbccb3e93eb13b24099fcdd4a4af32f2"><div class="ttname"><a href="classbn_1_1cpt.html#afbccb3e93eb13b24099fcdd4a4af32f2">bn::cpt::~cpt</a></div><div class="ttdeci">virtual ~cpt()</div><div class="ttdoc">(Default dtor) </div><div class="ttdef"><b>Definition:</b> cpt.hpp:71</div></div>
<div class="ttc" id="classbn_1_1cpt_html_ad089a05c56e9b6fca9b418d6a5a1934c"><div class="ttname"><a href="classbn_1_1cpt.html#ad089a05c56e9b6fca9b418d6a5a1934c">bn::cpt::parents</a></div><div class="ttdeci">std::vector&lt; rv_ptr &gt; const  &amp; parents() const noexcept</div><div class="ttdoc">Get the parent random variables of the target. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:145</div></div>
<div class="ttc" id="classbn_1_1cpt__manager_html_a07a7bded51671a92626b4737b8435de4"><div class="ttname"><a href="classbn_1_1cpt__manager.html#a07a7bded51671a92626b4737b8435de4">bn::cpt_manager::operator[]</a></div><div class="ttdeci">cpt_type &amp; operator[](node_type const &amp;node)</div><div class="ttdoc">CPT access operator. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:300</div></div>
<div class="ttc" id="classbn_1_1cpt_html"><div class="ttname"><a href="classbn_1_1cpt.html">bn::cpt</a></div><div class="ttdoc">A wrapper class of bn::matrix provides access methods to the CPT (Conditional Probability Table)...</div><div class="ttdef"><b>Definition:</b> cpt.hpp:33</div></div>
<div class="ttc" id="component_8hpp_html"><div class="ttname"><a href="component_8hpp.html">component.hpp</a></div><div class="ttdoc">Implementations of important elements of bn::network. </div></div>
<div class="ttc" id="classbn_1_1cpt__manager_html_a14f03f543695c769641ba4d2ed46761e"><div class="ttname"><a href="classbn_1_1cpt__manager.html#a14f03f543695c769641ba4d2ed46761e">bn::cpt_manager::at</a></div><div class="ttdeci">cpt_type &amp; at(node_type const &amp;node)</div><div class="ttdoc">CPT access. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:319</div></div>
<div class="ttc" id="classbn_1_1cpt__manager_html_a8b561a118dfde15785294db332eb1dcb"><div class="ttname"><a href="classbn_1_1cpt__manager.html#a8b561a118dfde15785294db332eb1dcb">bn::cpt_manager::enroll</a></div><div class="ttdeci">cpt_type &amp; enroll(node_type const &amp;node, cpt_type &amp;&amp;cpt)</div><div class="ttdoc">Register CPT to cpt_list. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:264</div></div>
<div class="ttc" id="classbn_1_1cpt__manager_html_af9f641392ccc1b1b0cc1361c270b9142"><div class="ttname"><a href="classbn_1_1cpt__manager.html#af9f641392ccc1b1b0cc1361c270b9142">bn::cpt_manager::at</a></div><div class="ttdeci">cpt_type const  &amp; at(node_type const &amp;node) const</div><div class="ttdoc">CPT access (const version) </div><div class="ttdef"><b>Definition:</b> cpt.hpp:327</div></div>
<div class="ttc" id="classbn_1_1cpt_html_a4e5ae968e96043ce5b37077ec071bcfe"><div class="ttname"><a href="classbn_1_1cpt.html#a4e5ae968e96043ce5b37077ec071bcfe">bn::cpt::operator[]</a></div><div class="ttdeci">matrix_type::element_type &amp; operator[](condition_type const &amp;condition)</div><div class="ttdoc">Access to probability list by condition r.v. list. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:117</div></div>
<div class="ttc" id="classbn_1_1cpt_html_a03d8950f94fe2738ad2812846d4c0a84"><div class="ttname"><a href="classbn_1_1cpt.html#a03d8950f94fe2738ad2812846d4c0a84">bn::cpt::rv</a></div><div class="ttdeci">rv_ptr const  &amp; rv() const noexcept</div><div class="ttdoc">Get the target random variable of this instance. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:136</div></div>
<div class="ttc" id="classbn_1_1cpt__manager_html"><div class="ttname"><a href="classbn_1_1cpt__manager.html">bn::cpt_manager</a></div><div class="ttdoc">A manager class of some CPTs corresponding to each nodes. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:237</div></div>
<div class="ttc" id="classbn_1_1cpt_html_a58fdfe1f84fad252a8ab6f1a859bf243"><div class="ttname"><a href="classbn_1_1cpt.html#a58fdfe1f84fad252a8ab6f1a859bf243">bn::cpt::cpt</a></div><div class="ttdeci">cpt(rv_ptr const &amp;rv)</div><div class="ttdoc">(ctor) Initialize CPT by random variable. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:45</div></div>
<div class="ttc" id="classbn_1_1cpt_html_ae5fe3c2f5f6398ba02d543dd946ba9e3"><div class="ttname"><a href="classbn_1_1cpt.html#ae5fe3c2f5f6398ba02d543dd946ba9e3">bn::cpt::operator=</a></div><div class="ttdeci">cpt &amp; operator=(cpt const &amp;other)</div><div class="ttdoc">(Copy assignment) </div><div class="ttdef"><b>Definition:</b> cpt.hpp:77</div></div>
<div class="ttc" id="classbn_1_1cpt_html_ab561a7d4b7aee7b6b674695bf5212780"><div class="ttname"><a href="classbn_1_1cpt.html#ab561a7d4b7aee7b6b674695bf5212780">bn::cpt::at</a></div><div class="ttdeci">matrix_type::element_type &amp; at(condition_type const &amp;condition)</div><div class="ttdoc">Access to probability list by condition r.v. list. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:97</div></div>
<div class="ttc" id="classbn_1_1cpt_html_ae8651cbb4c5e6ffd12e2c6817f200450"><div class="ttname"><a href="classbn_1_1cpt.html#ae8651cbb4c5e6ffd12e2c6817f200450">bn::cpt::reset</a></div><div class="ttdeci">void reset(std::vector&lt; rv_ptr &gt; parents)</div><div class="ttdoc">Change parent (conditional) nodes and reset. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:86</div></div>
<div class="ttc" id="classbn_1_1cpt__manager_html_a40b8026c5e356912aa9b7f9ee219db66"><div class="ttname"><a href="classbn_1_1cpt__manager.html#a40b8026c5e356912aa9b7f9ee219db66">bn::cpt_manager::unenroll</a></div><div class="ttdeci">void unenroll(node_type const &amp;node)</div><div class="ttdoc">Remove CPT corresponded to argument node from cpt_list. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:288</div></div>
<div class="ttc" id="classbn_1_1cpt_html_a1e5ffeaddbac53651afbbe782170de6d"><div class="ttname"><a href="classbn_1_1cpt.html#a1e5ffeaddbac53651afbbe782170de6d">bn::cpt::is_valid</a></div><div class="ttdeci">bool is_valid(condition_type const &amp;condition) const noexcept</div><div class="ttdoc">Verify whether given condition is sufficient in this instance. </div><div class="ttdef"><b>Definition:</b> cpt.hpp:155</div></div>
<div class="ttc" id="classbn_1_1cpt__manager_html_a14706adf5f0b9ec4f94628e4a8a1a43d"><div class="ttname"><a href="classbn_1_1cpt__manager.html#a14706adf5f0b9ec4f94628e4a8a1a43d">bn::cpt_manager::cpt_manager</a></div><div class="ttdeci">cpt_manager()=default</div><div class="ttdoc">(Default ctor) </div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
